#pragma once
#include <mutex>
#include <condition_variable>
#include <memory>
#include <queue>

template<typename T>

class LockQueue
{

public:
    void push(const T& date)
    {
        std::lock_guard<std::mutex> lock(lockmutex_);
        lockqueue_.push(date);
        lockcond_.notify_one();
    }
    T pop()
    {
        std::unique_lock<std::mutex> lock(lockmutex_);
        while(lockqueue_.empty())
        {
            lockcond_.wait(lock);
        }
        T data=lockqueue_.front();
        lockqueue_.pop();
        return data;
    }
private:
    std::mutex lockmutex_;
    std::condition_variable lockcond_;
    std::queue<T> lockqueue_;
};